﻿<%@ Register TagPrefix="ucCommon" TagName="Common" Src="../Common/Inc/Common.ascx" %>
<%@ Register TagPrefix="ucTop" TagName="Top" Src="../Common/Inc/Top.ascx" %>
<%@ Register TagPrefix="ucMenu" TagName="Menu" Src="../Common/Inc/Menu.ascx" %>
<%@ Register TagPrefix="ucTabTitle" TagName="TabTitle" Src="../Common/Inc/TabTitle.ascx" %>
<%@ Register TagPrefix="ucCopyright" TagName="Copyright" Src="../Common/Inc/Copyright.ascx" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Car1012m.aspx.cs" Inherits="Updms.Car.Car1012m" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>▒ UPDMS [Car1012m] ▒▒▒▒▒▒▒▒▒▒</title>
<ucCommon:Common id="Common" runat="server"></ucCommon:Common>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="ScriptManager1" EnableScriptGlobalization="true"></asp:ScriptManager>

<table id="table_frame">
	<tr>
		<td id="top_area" colspan="2">
			<!-- Top 시작 -->
			<ucTop:Top id="Top" runat="server"></ucTop:Top>
			<!-- Top 끝 -->
		</td>
	</tr>
	<tr>
		<td id="menu_area" runat="server">
			<!-- 메뉴 시작 -->
			<ucMenu:Menu id="Menu" runat="server"></ucMenu:Menu>
			<!-- 메뉴 끝 -->
		</td>
		<td id="contents_area">
			<!-- 제목 시작 -->
			<ucTabTitle:TabTitle id="TabTitle" TagPrefixs="Car1012m" runat="server"></ucTabTitle:TabTitle>
			<!-- 제목 끝 -->
			<!-- AJAX 시작 -->
			<asp:UpdatePanel ID="UpdatePanel1" runat="server">
			<Triggers>
				<asp:PostBackTrigger ControlID="ibtn_excel"/>
			</Triggers>
			<ContentTemplate>
			<!-- 버튼 시작 -->
			<div class="button_area">
				<asp:linkbutton id="ibtn_excel" Text="엑셀" runat="server" CssClass="ibtn ibtn_excel" OnClick="ibtn_excel_Click"></asp:linkbutton>
				<asp:linkbutton id="ibtn_close" Text="닫기" runat="server" CssClass="ibtn ibtn_close" OnClientClick="javascript:window.close();return false;"></asp:linkbutton>
				<asp:linkbutton id="ibtn_delete" Text="삭제" runat="server" CssClass="ibtn ibtn_delete" OnClientClick="return chkDelete()" OnClick="ibtn_delete_Click"></asp:linkbutton>
				<asp:linkbutton id="ibtn_save" Text="저장" runat="server" CssClass="ibtn ibtn_save" OnClientClick="return chkSave()" OnClick="ibtn_save_Click"></asp:linkbutton>
				<asp:linkbutton id="ibtn_search" Text="검색" runat="server" CssClass="ibtn ibtn_search" OnClientClick="return chkSearch(event)" OnClick="ibtn_search_Click"></asp:linkbutton>
			</div>
			<!-- 버튼 끝 -->
			<!-- 검색 시작 -->
			<table class="table_search">
				<tr>
					<td class="lbl" width="11%"><asp:Literal id="ltr_search_car_id" Text="차량" runat="server" /></td>
					<td class="ctl" width="22%"><asp:dropdownlist id="ddl_search_car_id" runat="server" CssClass="ddl"></asp:dropdownlist></td>
					<td class="lbl" width="11%"><asp:Literal id="ltr_search_div" Text="정비구분" runat="server" /></td>
					<td class="ctl" width="22%"><img src="../Common/Images/application_form.png" align="absmiddle" alt="multi_check" class="hand" onclick="showHiddenDiv('div_search_div', event);" /></td>
					<td class="lbl" width="11%"><asp:Literal id="ltr_search_service_dt" Text="정비일" runat="server" /></td>
					<td class="ctl" width="22%"><asp:textbox id="txt_search_service_dt_from" runat="server" CssClass="ib_b_dt"></asp:textbox>&nbsp;<img src="../Common/Images/calendar.png" id="ci_search_service_dt_from" class="ci_calendar" runat="server">&nbsp;~&nbsp;<asp:textbox id="txt_search_service_dt_to" runat="server" CssClass="ib_b_dt"></asp:textbox>&nbsp;<img src="../Common/Images/calendar.png" id="ci_search_service_dt_to" class="ci_calendar" runat="server"></td>
				</tr>
			</table>
			<!-- 검색 끝 -->
			<!-- 디테일1 시작 -->
			<table class="table_detail">
				<tr>
					<td style="text-align:center;" class="ctl" width="10%" rowspan="4"><img id="img_car_image" alt="" height="60" runat="server" /></td>
					<td class="lbl" width="10%"><asp:Literal id="ltr_service_id" Text="정비ID" runat="server" /></td>
					<td class="ctl" width="20%"><asp:Label ID="lbl_service_id" runat="server" Font-Bold="true"></asp:Label></td>
					<td class="lbl" width="10%"><asp:Literal id="ltr_div" Text="정비구분" runat="server" /></td>
					<td class="ctl" width="20%"><asp:dropdownlist id="ddl_div" runat="server" CssClass="ddl"></asp:dropdownlist></td>
					<td class="lbl" width="10%" rowspan="4"><asp:Literal id="ltr_contents" Text="정비내용" runat="server" /></td>
					<td class="ctl" width="20%" rowspan="4"><asp:textbox id="txt_contents" runat="server" Width="95.5%" CssClass="tb_scroll" TextMode="MultiLine" Rows="6" Height="83"></asp:textbox></td>
				</tr>
				<tr>
					<td class="lbl"><asp:Literal id="ltr_service_dt" Text="정비일" runat="server" /></td>
					<td class="ctl"><asp:textbox id="txt_service_dt" runat="server" CssClass="ib_b_dt req"></asp:textbox>&nbsp;<img src="../Common/Images/calendar.png" id="ci_service_dt" class="ci_calendar" runat="server"></td>
					<td class="lbl"><asp:Literal id="ltr_station_id" Text="정비소" runat="server" /></td>
					<td class="ctl"><asp:dropdownlist id="ddl_station_id" runat="server" CssClass="ddl"></asp:dropdownlist></td>
				</tr>
				<tr>
					<td class="lbl"><asp:Literal id="ltr_amount" Text="금액" runat="server" /></td>
					<td class="ctl"><asp:textbox id="txt_amount" runat="server" Width="97.5%" CssClass="ib_b_R req"></asp:textbox></td>
					<td class="lbl"><asp:Literal id="ltr_distance" Text="누적주행거리(㎞)" runat="server" /></td>
					<td class="ctl"><asp:textbox id="txt_distance" runat="server" Width="97.5%" CssClass="ib_b_R"></asp:textbox></td>
				</tr>
				<tr>
					<td class="lbl"><asp:Literal id="ltr_remark" Text="비고" runat="server" /></td>
					<td class="ctl" colspan="3"><asp:textbox id="txt_remark" runat="server" Width="99%" CssClass="ib_b"></asp:textbox></td>
				</tr>
			</table>
			<!-- 디테일1 끝 -->
			<!-- 부품 시작 -->
			<div class="sub_title_icon">
				<asp:Literal id="ltr_stitle_part" Text="부품" runat="server" /><asp:checkbox id="cb_part_list_all" runat="server" AutoPostBack="True" OnCheckedChanged="cb_part_list_all_CheckedChanged" ToolTip="Show All" style="position:relative;top:2px;left:4px;"></asp:checkbox>
			</div>
			<div class="div_scroll" style="height:27px; overflow-y:scroll;">
			<table class="table_gridview">
				<tr>
					<th width="2%">S</th>
					<th width="4%"><asp:Literal id="ltr_grid_no" Text="번호" runat="server" /></th>
					<th width="8%"><asp:Literal id="ltr_grid_part_id" Text="부품ID" runat="server" /></th>
					<th width="22%"><asp:Literal id="ltr_grid_part_nm" Text="부품명" runat="server" /></th>
					<th width="16%"><asp:Literal id="ltr_grid_inspection_distance" Text="점검기준거리(㎞)" runat="server" /></th>
					<th width="16%"><asp:Literal id="ltr_grid_change_distance" Text="교환기준거리(㎞)" runat="server" /></th>
					<th width="10%"><asp:Literal id="ltr_grid_amount" Text="금액" runat="server" /></th>
					<th width="22%"><asp:Literal id="ltr_grid_remark" Text="비고" runat="server" /></th>
				</tr>
			</table>
			</div>
			<div class="div_scroll" style="height:230px; overflow-y:scroll;" onscroll="javascript:setScroll(this);" id="div_detail_2" runat="server">
			<table id="table_parts" cellspacing="0" cellpadding="0" width="100%" border="0" runat="server">
				<tr>
					<td>
						<asp:GridView ID="gv_parts" CssClass="table_gridview_no_header" GridLines="None"  runat="server" AutoGenerateColumns="False" OnRowDataBound="gv_parts_RowDataBound" DataKeyNames="Seq,Service_Id,Save_Yn" ShowHeader="False">
							<Columns>
								<asp:TemplateField HeaderText="S">
									<ItemTemplate>
										<asp:CheckBox ID="cb_select" runat="server" AutoPostBack="True" OnCheckedChanged="cb_select_CheckedChanged" />
									</ItemTemplate>
									<ItemStyle HorizontalAlign="Center" Width="2%" />
								</asp:TemplateField>
								<asp:BoundField HeaderText="번호" DataField="Rnum" >
									<ItemStyle HorizontalAlign="Center" Width="4%" />
								</asp:BoundField>
								<asp:BoundField DataField="Seq" HeaderText="Seq(X)" Visible="False" />
								<asp:BoundField HeaderText="부품ID" DataField="Parts_Id" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Center" Width="8%" />
								</asp:BoundField>
								<asp:BoundField HeaderText="부품명" DataField="Parts_Nm" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Left" Width="22%" />
								</asp:BoundField>
								<asp:BoundField DataField="Service_Id" HeaderText="Service_Id(X)" Visible="False" />
								<asp:BoundField HeaderText="점검기준거리(㎞)" DataField="Check_Distance" DataFormatString="{0:###,##0}" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Right" Width="16%" />
								</asp:BoundField>
								<asp:BoundField HeaderText="교환기준거리(㎞)" DataField="Change_Distance" DataFormatString="{0:###,##0}" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Right" Width="16%" />
								</asp:BoundField>
								<asp:TemplateField HeaderText="금액">
									<ItemTemplate>
										<asp:TextBox ID="txt_parts_amount" runat="server" CssClass="ib_b_sR" Enabled="False" Text='<%# Bind("Amount") %>' Width="98%"></asp:TextBox>
									</ItemTemplate>
									<ItemStyle Width="10%" HorizontalAlign="Right" />
								</asp:TemplateField>
								<asp:TemplateField HeaderText="비고">
									<ItemTemplate>
										<asp:TextBox ID="txt_parts_remark" TextMode="MultiLine" runat="server" CssClass="tb_scroll" Height="12" Enabled="False" Text='<%# Bind("Remark") %>' Width="96%"></asp:TextBox>
									</ItemTemplate>
									<ItemStyle HorizontalAlign="Left" Width="20%" />
								</asp:TemplateField>
								<asp:TemplateField HeaderText="확장">
									<ItemTemplate>
										<asp:CheckBox ID="cb_parts_remark" runat="server"></asp:CheckBox>
									</ItemTemplate>
									<ItemStyle Width="2%" HorizontalAlign="Center" />
								</asp:TemplateField>
								<asp:BoundField DataField="Save_Yn" HeaderText="Save_Yn(X)" Visible="False" />
							</Columns>							
						</asp:GridView>
					</td>
				</tr>
			</table>
			</div>
			<div class="div_scroll" style="height:33px; overflow-y:scroll;">
			<table class="table_gridview">
				<tr>
					<td width="2%" class="total"></td>
					<td width="4%" class="total"></td>
					<td width="8%" class="total"></td>
					<td width="22%" class="total"></td>
					<td width="16%" class="total"></td>
					<td width="16%" class="total"><asp:linkbutton id="lbtn_calc_total_amount" runat="server" OnClick="lbtn_calc_total_amount_Click" Font-Underline="true" Text="Total" /></td>
					<td width="10%" class="money"><asp:Literal id="ltr_calc_total_amount" Text="0" runat="server" /></td>
					<td width="22%" class="total"></td>
				</tr>
			</table>
			</div>
			<!-- 부품 끝 -->
			<div style="height:20px;"></div>
			<!-- 리스트셋 시작 -->
			<table  cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td>
						<!-- 검색어 시작 -->
						<div class="div_left">Keyword : <asp:label id="lbl_search_keyword" runat="server"></asp:label></div>
						<div class="div_right"><asp:checkbox id="cb_list_all" runat="server" AutoPostBack="True" OnCheckedChanged="cb_list_all_CheckedChanged" ToolTip="Show All"></asp:checkbox></div>
						<!-- 검색어 끝 -->
					</td>
				</tr>
				<tr>
					<td>
						<!-- 리스트 시작 -->
						<asp:GridView ID="GridView1" CssClass="table_gridview" GridLines="None" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand" DataKeyNames="Seq,Car_Id,Service_Id,Div,Station_Id,Remark" ShowFooter="true">
							<Columns>
								<asp:TemplateField HeaderText="&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;checkBoxCheck('GridView1');&quot;&gt;S&lt;/a&gt;">
									<ItemTemplate>
										<input id="cb_check" class="cb" type="checkbox" onclick="reverseRow('GridView1', 0);" runat="server" />
									</ItemTemplate>
									<ItemStyle HorizontalAlign="Center" Width="2%" />
								</asp:TemplateField>
								<asp:BoundField HeaderText="번호">
									<ItemStyle HorizontalAlign="Center" Width="4%" />
								</asp:BoundField>
								<asp:BoundField DataField="Seq" HeaderText="Seq(X)" Visible="False" />
								<asp:BoundField DataField="Car_Id" HeaderText="Car_Id(X)" Visible="False" />
								<asp:BoundField DataField="Car_Nm" HeaderText="차량" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Center" Width="12%" />
								</asp:BoundField>
								<asp:BoundField DataField="Service_Id" HeaderText="Service_Id(X)" Visible="False" />
								<asp:BoundField DataField="Div" HeaderText="Div(X)" Visible="False" />
								<asp:BoundField DataField="Div_Nm" HeaderText="구분" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Left" Width="6%" />
								</asp:BoundField>
								<asp:TemplateField HeaderText="정비일">
									<ItemTemplate>
										<asp:LinkButton ID="lbtn_rc" runat="server" Text='<%# Bind("Service_Dt") %>'></asp:LinkButton>
									</ItemTemplate>
									<ItemStyle HorizontalAlign="Center" Width="8%" />
									<HeaderStyle CssClass="lbtn_rc" />
								</asp:TemplateField>
								<asp:BoundField DataField="Station_Id" HeaderText="Station_Id(X)" Visible="False" />
								<asp:BoundField DataField="Station_Nm" HeaderText="정비소" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Left" Width="12%" />
								</asp:BoundField>
								<asp:BoundField DataField="NaverMap_Link" HeaderText="위치" HtmlEncode="False" >
									<HeaderStyle Font-Underline="True" />
									<ItemStyle HorizontalAlign="Center" Width="6%" />
								</asp:BoundField>
								<asp:BoundField DataField="Contents" HeaderText="정비내용" HtmlEncode="False" >
									<ItemStyle HorizontalAlign="Left" Width="30%" />
								</asp:BoundField>
								<asp:BoundField DataField="Amount" HeaderText="금액" HtmlEncode="False" DataFormatString="{0:###,##0}" >
									<ItemStyle HorizontalAlign="Right" Width="8%" />
								</asp:BoundField>
								<asp:BoundField DataField="Distance" HeaderText="누적주행거리" HtmlEncode="False" DataFormatString="{0:###,##0}" >
									<ItemStyle HorizontalAlign="Right" Width="12%" />
								</asp:BoundField>
								<asp:BoundField DataField="Remark" HeaderText="Remark(X)" HtmlEncode="False" Visible="False" />
							</Columns>
							<EmptyDataTemplate>
								<div id="no_data"></div>
							</EmptyDataTemplate>
						</asp:GridView>
						<!-- 리스트 끝 -->
					</td>
				</tr>
				<tr>
					<td>
						<!-- 페이징 시작 -->
						<div class="div_left">Result : <asp:label id="lbl_result_count" runat="server"></asp:label></div>
						<div class="div_right"><asp:label id="lbl_page" runat="server"></asp:label></div>
						<!-- 페이징 끝 -->
					</td>
				</tr>
			</table>
			<!-- 리스트셋 끝 -->
			<!-- 다중검색 시작 -->
			<div id="div_search_div" class="div_scroll div_multi_box" style="display:none;height:80px;width:100px;position:absolute;overflow-y:auto;">
				<asp:CheckBoxList id="cbl_search_div" runat="server" RepeatDirection="Vertical" CssClass="cbl_vertical"></asp:CheckBoxList>
			</div>
			<!-- 다중검색 끝 -->
			<!-- 카피라이트 시작 -->
			<ucCopyright:Copyright id="Copyright" runat="server"></ucCopyright:Copyright>
			<!-- 카피라이트 끝 -->
			<!-- 히든값 시작 -->
			<div id="hdn_data">
				<asp:label id="lbl_pk" runat="server"></asp:label>
				<asp:Label id="lbl_search_flag" runat="server"></asp:Label>
				<input id="h_no" type="hidden" name="h_no" runat="server" />
				<input id="h_scroll_pos" type="hidden" name="h_scroll_pos" value="0" runat="server" />
			</div>
			<!-- 히든값 끝 -->
			<!-- FilteredTextBoxExtender 시작 -->
			<act:FilteredTextBoxExtender ID="fte_amount"
				runat="server"
				TargetControlID="txt_amount"
				FilterType="Custom, Numbers"
				ValidChars=",">
			</act:FilteredTextBoxExtender>
			<act:FilteredTextBoxExtender ID="fte_distance"
				runat="server"
				TargetControlID="txt_distance"
				FilterType="Custom, Numbers"
				ValidChars=",">
			</act:FilteredTextBoxExtender>
			<!-- FilteredTextBoxExtender 끝 -->
			<!-- CalendarExtender 시작 -->
			<act:CalendarExtender ID="ce_search_service_dt_from"
				runat="server"
				TargetControlID="txt_search_service_dt_from"
				Format="yyyy-MM-dd"
				PopupButtonID="ci_search_service_dt_from"
				EnableViewState="False"
				BehaviorID="bi_search_service_dt_from"
				CssClass="calendar">
			</act:CalendarExtender>
			<act:CalendarExtender ID="ce_search_service_dt_to"
				runat="server"
				TargetControlID="txt_search_service_dt_to"
				Format="yyyy-MM-dd"
				PopupButtonID="ci_search_service_dt_to"
				EnableViewState="False"
				BehaviorID="bi_search_service_dt_to"
				CssClass="calendar">
			</act:CalendarExtender>
			<act:CalendarExtender ID="ce_service_dt"
				runat="server"
				TargetControlID="txt_service_dt"
				Format="yyyy-MM-dd"
				PopupButtonID="ci_service_dt"
				EnableViewState="False"
				BehaviorID="bi_service_dt"
				CssClass="calendar">
			</act:CalendarExtender>
			<!-- CalendarExtender 끝 -->
			</ContentTemplate>
			</asp:UpdatePanel>
			<!-- AJAX 끝 -->
		</td>
	</tr>
</table>

<asp:updateprogress AssociatedUpdatePanelID="UpdatePanel1" ID="updateProgress" runat="server">
	<progresstemplate>
		<div id="progressBackgroundFilter"></div>
		<div id="processMessage">
			<div id="processing"></div>
			<img src="../Common/Images/processing_img.gif" />
		</div>
	</progresstemplate>
</asp:updateprogress>

</form>
<script type="text/javascript" language="javascript">
	//검색
	function chkSearch(evt) {
		var e = (!evt) ? window.event : evt;
		var keyCode = e.keyCode;
		
		//날짜형식
		if (!isDateHyphen($F("txt_search_service_dt_from"))) {
			msgBox.alert(getMsg(MSG_ERR_082), setFocus, "txt_search_service_dt_from", keyCode); //잘못된 날짜형식입니다.(YYYY-MM-DD)
			return false;
		}
		if (!isDateHyphen($F("txt_search_service_dt_to"))) {
			msgBox.alert(getMsg(MSG_ERR_082), setFocus, "txt_search_service_dt_to", keyCode); //잘못된 날짜형식입니다.(YYYY-MM-DD)
			return false;
		}

		// 날짜 체크
		if(!isDateSeq($F("txt_search_service_dt_from"), $F("txt_search_service_dt_to"))) {
			msgBox.alert(getMsg(MSG_ERR_022), null, null, keyCode); //시작일자가 종료일자보다 늦을수 없습니다
			return false;
		}
		return true;
	}

	//엔터검색
	function enterSearchOnPage(evt) {
		var e = (!evt) ? window.event : evt;
		var keyCode = e.keyCode;

		if (keyCode == 13) {
			if (chkSearch(evt)) {
				__doPostBack('ibtn_search', '');
			}
		}
	}

	//저장
	function chkSave() {
		if ($F("txt_service_dt").blank()) {
			msgBox.alert(getMsg(MSG_ERR_095), setFocus, "txt_service_dt");	//정비일을 입력하세요
			return false;
		}

		if ($F("txt_amount").blank()) {
			msgBox.alert(getMsg(MSG_ERR_035), setFocus, "txt_amount");	//금액을 입력하세요
			return false;
		}

		var pk = $get("lbl_pk").innerHTML;
		var MSG_ID = (pk == "") ? MSG_CFM_000 : MSG_CFM_028; //저장/수정
		msgBox.confirm(getMsg(MSG_ID), doSave); //저장하시겠습니까?

		return false;
	}
	
	//삭제
	function chkDelete() {
		if(!isCheckedOnGridView("GridView1", 0)) {
			msgBox.alert(getMsg(MSG_ERR_053));	//삭제할 항목을 선택하세요
			return false;
		}
		msgBox.confirm(getMsg(MSG_CFM_001), doDelete);	//삭제하시겠습니까?
		return false;
	}

	//onscroll 이벤트 발생시 스크롤바 위치값 실시간 저장
	function setScroll(val) {
		$("h_scroll_pos").value = val.scrollTop;
	}

	//코드비하인드에서 RegisterStartupScript 매서드를 사용해 호출할 스크롤 위치 셋팅 함수
	function scrollTo() {
		var vScrollPos = $F("h_scroll_pos");  // PostBakc 발생전 스크롤바 위치값
		$("div_detail_2").scrollTop = vScrollPos ;  // GridView를 감싼 Div 컨트롤의 scrollTop 속성값 셋팅
	}

	//비고 전체보기
	function extendRemark(remark_id, extend_id) {
		var h = 12;
		if ($(extend_id).checked) {
			h = 80;
		}
		$(remark_id).style.height = h + "px";
	}

</script>
</body>
</html>